
$logFile = [String]::Format('{0}\{1}', $env:BTAD_InstallDir, 'Deployment\Sixeyed.CacheAdapterSample.Uninstall.ps1.log')
[IO.File]::Delete($logFile)
[IO.File]::AppendAllText($logFile, [String]::Format('Uninstallation started: {0}{1}', [DateTime]::Now, [Environment]::NewLine))

[IO.File]::AppendAllText($logFile, 'Deleting FILE locations')
[IO.File]::AppendAllText($logFile, [Environment]::NewLine)

remove-item 'c:\drops\SimpleMessaging' -recurse -force
remove-item 'c:\drops\ComplexMessaging' -recurse -force
remove-item 'c:\drops\Orchestration' -recurse -force

[IO.File]::AppendAllText($logFile, 'Removing configuration settings from SSO')
[IO.File]::AppendAllText($logFile, [Environment]::NewLine)

[Reflection.Assembly]::Load('SSOConfig, Version=1.0.0.0, Culture=neutral, PublicKeyToken=656a499478affdaf')
$app = [SSOConfig.SSOApplication]::LoadFromSSO('Sixeyed.CacheAdapter')
$app.Fields[0].Value = '<?xml version="1.0"?><messageCacheConfigurationCollection xmlns="http://schemas.sixeyed.com/CacheAdapter/2009"><messageCacheConfigurations/></messageCacheConfigurationCollection>'
$app.SaveToSSO()

[IO.File]::AppendAllText($logFile, [String]::Format('Uninstallation completed: {0}', [DateTime]::Now))